
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<f:view>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <LINK rel="stylesheet" type="text/css" href="commun_styles.css"/>
        <title>Services</title>
    </head>
    <body>
        <h:form id="formservice">
                <a4j:include viewId="entete.jsp"/>
                <a4j:include viewId="menu.jsp"/>
                <h:inputHidden value="#{ServiceBean.init}" />
                <rich:spacer height="50px" />
                <center>
                    <rich:tabPanel style="width:500px;">
                        <rich:tab label="Services">
                            <h:outputText id="infomsg" value="#{ServiceBean.message}" styleClass="valid_message"/>
                            <h:panelGrid width="450px" columns="1">
                                <rich:panel id="tablepanel" header="Liste Services" >
                                    <rich:dataTable
                                        binding="#{ServiceBean.dataTable}" onRowMouseOver="this.style.backgroundColor='#B5CEFD'"
                                        onRowMouseOut="this.style.backgroundColor='#{org.richfaces.SKIN.tableBackgroundColor}'"
                                        onRowClick="this.style.backgroundColor='#F1F1F1'"
                                        rows="8" width="100%" id="tbl" value="#{ServiceBean.service_list}" var="serv">
                                    <rich:column>
                                        <f:facet name="header">
                                            <h:outputText value="Code"/>
                                        </f:facet>
                                        <h:outputText value="#{serv.servCode}"/>
                                    </rich:column>
                                    <rich:column width="230px">
                                        <f:facet name="header">
                                            <h:outputText value="Libelle"/>
                                        </f:facet>
                                        <h:outputText value="#{serv.servLib}"/>
                                    </rich:column>
                                    <rich:column style="text-align:center">
                                        <f:facet name="header">
                                            <h:outputText value="Modifier"/>
                                        </f:facet>
                                        <a4j:commandLink action="#{ServiceBean.modifierLigne}" reRender="infomsg,tablepanel,panelinfo,crud_panel" >
                                            <h:graphicImage style="border:0" url="/images/Modify.gif" />
                                        </a4j:commandLink>
                                    </rich:column>
                                    <rich:column style="text-align:center">
                                        <f:facet name="header">
                                            <h:outputText value="Supprimer"/>
                                        </f:facet>
                                        <a4j:commandLink action="#{ServiceBean.supprimer}" ajaxSingle="true" reRender="infomsg,tablepanel,panelinfo,crud_panel">

                                            <h:graphicImage style="border:0" url="/images/Delete.gif"/>
                                        </a4j:commandLink>
                                    </rich:column>
                                    <f:facet name="footer">
                                        <rich:datascroller/>
                                    </f:facet>
                                    </rich:dataTable>
                                    </rich:panel>
                                    <rich:panel id="panelinfo" header="Information générales">
                                        <h:panelGrid columns="2" width="350" >
                                            <h:outputText value="Code service : " />
                                            <h:inputText disabled="#{ServiceBean.etat}" id="codserv" value="#{ServiceBean.serv.servCode}" size="25" maxlength="30">
                                            </h:inputText>
                                            <h:outputText value="Libelle : "/>
                                            <h:inputText disabled="#{ServiceBean.etat}" value="#{ServiceBean.serv.servLib}" id="libserv" size="25" maxlength="30"/>
                                            <h:outputText value="Description : "/>
                                            <h:inputText disabled="#{ServiceBean.etat}" value="#{ServiceBean.serv.servDescr}" id="descrserv" size="25" maxlength="50"/>
                                        </h:panelGrid>
                                    </rich:panel>
                            </h:panelGrid>
                            <h:panelGrid id="crud_panel" columns="5">
                                <a4j:commandButton id="nouvserv" value="Nouveau" style="width:85px"
                                ajaxSingle="true" disabled="#{ServiceBean.invetat}" action="#{ServiceBean.viderChamps}"
                                reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
                                <a4j:commandButton id="modifserv" value="Modifier" style="width:85px"
                                ajaxSingle="true" disabled="#{ServiceBean.invetat}" action="#{ServiceBean.modifier}"
                                reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
                                <a4j:commandButton id="suppserv" value="Supprimer" style="width:85px"
                                ajaxSingle="true" disabled="#{ServiceBean.invetat}" action="#{ServiceBean.supprimer}"
                                reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
                                <a4j:commandButton id="validserv" value="Valider" style="width:85px"
                                disabled="#{ServiceBean.etat}" action="#{ServiceBean.create}"
                                reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
                                <a4j:commandButton id="annulserv" value="Annuler" style="width:85px"
                                ajaxSingle="true" disabled="#{ServiceBean.etat}" action="#{ServiceBean.annuler}"
                                reRender="infomsg,tablepanel,panelinfo,crud_panel"/>
                            </h:panelGrid>
                        </rich:tab>
                    </rich:tabPanel>
                </center>
            </h:form>
    </body>
</html>
</f:view>